﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Sinacor.OMM.Configuration.Receptor
{
    /// <summary>
    /// Configuração de um canal de comunicação
    /// </summary>
    public class CommunicationChannel
    {
        private Int32 _id;
        private string _name = String.Empty;
        private string _description = String.Empty;
        private string _user = String.Empty;
        private string _password = String.Empty;
        private string _employee = String.Empty;
        private String _controllerFilePath = String.Empty;
        private string _macAddress;
        private Repository.RepositoryConfiguration _messageMainRepository = new Repository.RepositoryConfiguration();
        private Repository.RepositoryConfiguration _systemMessageRepository = new Repository.RepositoryConfiguration();

        /// <summary>
        /// Id
        /// </summary>
        public Int32 Id
        {
            get { return _id; }
            set { _id = value; }
        }

        /// <summary>
        /// Name
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        /// <summary>
        /// Description
        /// </summary>
        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        /// <summary>
        /// User
        /// </summary>
        public string User
        {
            get 
            {
                return _user;
            }
            set 
            {
                _user = value;
            }
        }

        /// <summary>
        /// Password
        /// </summary>
        public string Password
        {
            get
            {
                if (!String.IsNullOrEmpty(_password))
                    return PSE.Framework.Cryptography.RijndaelCryptographer.DecryptString(_password);
                else
                    return _password;
            }
            set
            {
                _password = value;
            }
        }

        /// <summary>
        /// Employee
        /// </summary>
        public string Employee
        {
            get
            {
                return _employee;
            }
            set
            {
                _employee = value;
            }
        }

        /// <summary>
        /// Controller file path
        /// </summary>
        public String ControllerFilePath
        {
            get 
            { 
                return _controllerFilePath; 
            }
            set 
            { 
                _controllerFilePath = value; 
            }
        }

        /// <summary>
        /// Message main repository  
        /// </summary>
        public Repository.RepositoryConfiguration MessageMainRepository
        {
            get { return _messageMainRepository; }
            set { _messageMainRepository = value; }
        }

        /// <summary>
        /// System Message Repository  
        /// </summary>
        public Repository.RepositoryConfiguration SystemMessageRepository
        {
            get { return _systemMessageRepository; }
            set { _systemMessageRepository = value; }
        }

        public string MacAddress
        {
            get { return _macAddress; }
            set { _macAddress = value; }
        }
        
    }
}
